<template>
  <div>
    <el-tabs v-model="activeName">

      <el-tab-pane name="first">
        <div slot="label" @click="myPurchaseClick">发送的申请</div>
        <my-purchase ref="myPurchase"></my-purchase>
      </el-tab-pane>

      <el-tab-pane name="second">
        <div slot="label" @click="recievePurchaseClick">接收的申请</div>
        <recieve-purchase ref="recievePurchase"></recieve-purchase>
      </el-tab-pane>

    </el-tabs>
  </div>
</template>
<script>
  import MyPurchase from './module/purchase/send-purchase'
  import RecievePurchase from './module/purchase/receive-purchase'
  export default {
    data() {
      return {
        activeName: 'first'
      }
    },
    components: {
      MyPurchase,
      RecievePurchase
    },
    activated() {
      this.myPurchaseClick()
    },
    methods: {
      myPurchaseClick() {
        this.$nextTick(() => {
          this.$refs.myPurchase.getDataList()
        })
      },
      recievePurchaseClick() {
        this.$nextTick(() => {
          this.$refs.recievePurchase.getDataList()
        })
      }
    }
  }
</script>